<?php
/* OpenManage
 * Generic Plugin Launch Utility
 * launch.php
 * Released under the GNU General Public Licnese version 3
 */

/* @author Ciaran Crocker <ciaran.crocker5@gmail.com>
 * @version $$id$$
 */

require('initializeEnvironment.php');
$command = getScriptVariable('command');
$plugin = getScriptVariable('plugin');

try {
	if(!isset($plugin)) {
		die('0-NOPLUGIN');
	}elseif(!isset($command)) {
		die('1-NOCOMMAND');
	};
} catch(Exception $e) {
	echo('EXCEPTION.' . $e->GetMessage());
	exit();
};

$plugin_exists = checkPluginExists($plugin);

try {
	if($plugin_exists) {
		break;
	} else {
		throw new Exception('2-PLUGINNOTFOUND');
	};
} catch(Exception $e) {
	echo('EXCEPTION.' . $e-GetMessage());
	exit();
};


$command_exists = checkCommandExists($command);

try {
	if($command_exists) {
		break;
	} else {
		throw new Exception('3-COMMANDNOTFOUND');
	};
} catch(Exception $e) {
	echo('EXCEPTION.' . $e->GetMessage());
	exit();
};

?>